{extend name="admin@Base/base"/}

{block name="body"}
    <div class="main-title">
        <h2>自定义菜单管理</h2>
    </div>

    <div class="clearfix with-padding row">
        <div class="col-xs-10">
            <a class="btn btn-ajax btn-success btn btn-default" href="{:url('add')}">新 增</a>
            <a class="btn btn-ajax btn-success btn btn-default" href="{:url('create')}"  >生成微信自定义菜单</a>
            <a class="btn btn-ajax btn-success btn btn-default" href="{:url('getmenu')}"  >获取公众号现有自定义菜单</a>
        </div>
    </div>

    <div class="with-padding">
        <form action="{:url('index')}" method="post" class="form-horizontal" >
        <ul class="channel-ul">
        {volist name="list" id="cms" key="id"}

            {foreach name="cms" item="cm"}

            <li class="clearfix pLi" >
                <div class="pull-left nav_list">



                    <input name="cm[1][title][]" placeholder="请输入标题" class="form-control title" style="width: 100px;" value="{$cm.title}">
                    {notempty name="$cm.url"}
                    <input name="cm[1][url][]" placeholder="请输入带http://链接"   class="form-control url" style="width: 300px;" value=" {$cm.url}">
                    {/notempty}
                </div>


                <div class='pull-left i-list'>

                    <a href="javascript:" title="添加一级菜单" class="add-one"><i class="icon icon-plus"></i></a>
                    <a href="javascript:"  title="移除此菜单" class="remove-li"><i class="icon icon-remove"></i></a>
                    <a href="javascript:" title="添加子菜单" class="add-child"><i class="icon icon-sitemap"></i></a>
                    <a href="javascript:" title="移动菜单排序"><i class="icon icon-move sort-handle-1"></i></a>
                </div>


                {php}if(array_key_exists("child", $cm)){{/php}
                <div class="clearfix"></div>
                <ul class="ul-2"  style="display: block;">
                    {volist name="cm['child']" id="child"}
                    <li class="clearfix" >
                        <input name="cm[2][pid][]" class="pid" style="display: none">
                        <div class="pull-left nav_list">



                            <input name="cm[2][title][]" placeholder="请输入标题" class="form-control title" style="width: 100px;" value="{$child.title}">
                            {notempty name="$child.url"}
                            <input name="cm[1][url][]" placeholder="请输入带http://链接"   class="form-control url" style="width: 300px;" value=" {$child.url}">
                            {/notempty}
                        </div>

                        <div class='pull-left i-list'>

                            <a href="javascript:" title="添加菜单" class="add-two"><i class="icon icon-plus"></i></a>
                            <a href="javascript:"   title="移除此菜单" class="remove-li"><i class="icon icon-remove"></i></a>
                            <a href="javascript:"  title="移动菜单排序"><i class="icon icon-move sort-handle-2"></i></a>
                        </div>

                    </li>



                    {/volist}
                </ul>

                {php}}{/php}

                {/foreach}
        {/volist}
        </ul>

            <div class="form-item with-padding">
                <button class="btn submit-btn ajax-post no-refresh" id="submit" type="submit" target-form="form-horizontal">确 定</button>

                <input class="btn submit-btn" type="submit" onclick="javascript:this.form.action='{:url('previewmenu')}';" value="预览" >
                <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
            </div>
        </form>
    </div>



{/block}

{block name="script"}
{load href="__ROOT__/admin/static/js/jquery.simple-color.js" /}
{load href="__ROOT__/mpbase/static/js/custommenu.js" /}
{load href="__ROOT__/zui/lib/chosen/chosen.icons.min.js" /}
{load href="__ROOT__/zui/lib/chosen/chosen.icons.css" /}
{/block}